package com.phpxiu.app.model.msg;
import com.tencent.TIMMessage;
import com.tencent.TIMSoundElem;

/**
 * Created by 吴金洲 on 2016/7/26
 */
public class C2CVoiceMsg extends C2CMsg {
    private static final String TAG = "C2CVoiceMsg";
    public C2CVoiceMsg(TIMMessage message){
        this.message = message;
    }
    /**
     * 语音消息构造方法
     * @param duration 时长
     * @param data 语音数据
     */
    public C2CVoiceMsg(long duration,byte[] data){
        message = new TIMMessage();
        TIMSoundElem elem = new TIMSoundElem();
        elem.setData(data);
        elem.setDuration(duration);  //填写语音时长
        message.addElement(elem);
    }

    /**
     * 语音消息构造方法
     *
     * @param duration 时长
     * @param filePath 语音数据地址
     */
    public C2CVoiceMsg(long duration,String filePath){
        message = new TIMMessage();
        TIMSoundElem elem = new TIMSoundElem();
        elem.setPath(filePath);
        elem.setDuration(duration);  //填写语音时长
        message.addElement(elem);
    }

}
